home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d2 / uneedit.arc / SYSID32.ARC / CPUID.LST < prev    next >
File List  |  1988-12-17  |  6KB  |  187 lines

  1.  Microsoft MACRO Assembler  Version 3.00                   Page    1-1
  2.                                        07-08-88    
  3.  
  4.  
  5. 1                        ;--------------------------------------
  6.                    ---------------------------------------
  7. 2                        ;
  8. 3                        ;    CPUID.ASM
  9. 4                        ;    Version 1.1
  10. 5                        ;
  11. 6                        ;    A procedure used by SYSID.PAS.
  12. 7                        ;
  13. 8                        ;    CPUID returns these values in A
  14.                    X:
  15. 9                        ;         AH7 :    (not used, alwa
  16.                    ys 0)
  17. 10                        ;         AH6 :    (not used, alwa
  18.                    ys 0)
  19. 11                        ;         AH5 :    (not used, alwa
  20.                    ys 0)
  21. 12                        ;         AH4 :    (not used, alwa
  22.                    ys 0)
  23. 13                        ;         AH3 :    1 if CPU mishan
  24.                    dles interrupts of multi-prefix string
  25. 14                        ;              instructions (I
  26.                    ntel)
  27. 15                        ;         AH2 :    1 if PUSH SP wr
  28.                    ites, then decrements (80286)
  29. 16                        ;         AH1 :    1 if shift inst
  30.                    ructions ignore high 3 bits in register
  31. 17                        ;              displacement (8
  32.                    018x, 80286)
  33. 18                        ;         AH0 :    1 if prefetch i
  34.                    nstruction queue is 6 bytes (80x86)
  35. 19                        ;         AL :     0 if no coproce
  36.                    ssor present
  37. 20                        ;              1 if 8087 prese
  38.                    nt
  39. 21                        ;              2 if 80287 pres
  40.                    ent
  41. 22                        ;
  42. 23                        ;    CPUID uses self-modifying code 
  43.                    to determine the length of the prefetch
  44. 24                        ;    instruction queue and should th
  45.                    erefore be run only once in the course
  46. 25                        ;    of the calling program.
  47. 26                        ;
  48. 27                        ;    CPUID was shamelessly stolen fr
  49.                    om Bob Smith's article "Chips in
  50. 28                        ;    Transition," PC Tech Journal 4:
  51.                    4, p. 56. It was assembled into
  52. 29                        ;    CPUID.OBJ with MASM Version 3.0
  53.                    .
  54. 30                        ;
  55. 31                        ;    Steve Grant
  56. 32                        ;    Long Beach, CA
  57. 33                        ;    July 8, 1988
  58. 34                        ;
  59.  Microsoft MACRO Assembler  Version 3.00                   Page    1-2
  60.                                        07-08-88    
  61.  
  62.  
  63. 35                        ;--------------------------------------
  64.                    ---------------------------------------
  65. 36                        
  66. 37                        .287
  67. 38     0000                   code    segment    byte public
  68. 39                                assume  cs:code,ds:code
  69. 40                             public    cpuid
  70. 41     0000                   cpuid    proc    near
  71. 42     0000  55                   push    bp
  72. 43     0001  8B EC                   mov    bp,sp
  73. 44     0003  33 C0                   xor    ax,ax
  74. 45     0005  50                   push    ax
  75. 46     0006  B9 FFFF                   mov    cx,0FFFFH
  76. 47     0009  FB                   sti
  77. 48     000A  F3/ 26: AC         rep    lods    byte ptr es:[si]
  78. 49     000D  58                   pop    ax
  79. 50     000E  E3 03                   jcxz    a1
  80. 51     0010  80 CC 08                   or    ah,08H         
  81.                          ; if CPU is Intel
  82. 52     0013                   a1:
  83. 53     0013  50                   push    ax
  84. 54     0014  54                   push    sp
  85. 55     0015  58                   pop    ax
  86. 56     0016  3B C4                   cmp    ax,sp
  87. 57     0018  58                   pop    ax
  88. 58     0019  75 03                   jne    a2
  89. 59     001B  80 CC 04                   or    ah,04H         
  90.                          ; if cpu is 8028x
  91. 60     001E                   a2:
  92. 61     001E  50                   push    ax
  93. 62     001F  B1 21                   mov    cl,21H
  94. 63     0021  B0 FF                   mov    al,0FFH
  95. 64     0023  D2 E0                   shl    al,cl
  96. 65     0025  58                   pop    ax
  97. 66     0026  74 03                   jz    a3
  98. 67     0028  80 CC 02                   or    ah,02H         
  99.                          ; if cpu is 8018x or 8028x
  100. 68     002B                   a3:
  101. 69     002B  50                   push    ax
  102. 70     002C  B5 00                   mov    ch,0
  103. 71     002E  1E                      push    ds
  104. 72     002F  0E                      push    cs
  105. 73     0030  1F                      pop     ds
  106. 74     0031  FA                   cli
  107. 75     0032  EB 00                      jmp     $+2                    
  108.                     ; empty queue
  109. 76     0034  C6 06 003A R 00              mov    byte ptr a4,0
  110. 77     0039  B1                   db    0B1H         
  111.                          ; MOV    CL,...
  112. 78     003A  01              a4:    db    1         
  113.                          ; ...1
  114. 79     003B  FB                   sti
  115. 80     003C  1F                      pop     ds
  116. 81     003D  58                   pop    ax
  117.  Microsoft MACRO Assembler  Version 3.00                   Page    1-3
  118.                                        07-08-88    
  119.  
  120.  
  121. 82     003E  E3 03                   jcxz    a5
  122. 83     0040  80 CC 01                   or    ah,01H         
  123.                          ; if PIQ length=6 (80x86)
  124. 84     0043                   a5:
  125. 85     0043  FA                   cli
  126. 86     0044  D9 36 007C R              fnstenv    ndp_env
  127. 87     0048  FB                   sti
  128. 88     0049  DB E3                   fninit
  129. 89     004B  D9 3E 008A R              fnstcw    ndp_cw
  130. 90     004F  80 3E 008B R 03              cmp    byte ptr ndp_cw+1,03h
  131. 91     0054  B0 00                   mov    al,0
  132. 92     0056  75 22                   jne    a6
  133. 93     0058  80 26 008A R 7F              and    byte ptr ndp_cw,7FH
  134. 94     005D  9B D9 2E 008A R              fldcw    ndp_cw
  135. 95     0062  9B DB E1                   fdisi
  136. 96     0065  9B D9 3E 008A R              fstcw    ndp_cw
  137. 97     006A  9B D9 26 007C R              fldenv    ndp_env
  138. 98     006F  F6 06 008A R 80              test    byte ptr ndp_cw,80H
  139. 99     0074  B0 01                   mov    al,1
  140. 100     0076  75 02                   jnz    a6
  141. 101     0078  B0 02                   mov    al,2
  142. 102     007A                   a6:
  143. 103     007A  5D                   pop    bp
  144. 104     007B  C3                   ret
  145. 105     007C                   ndp_env    label    word
  146. 106     007C     07 [                   dw    7 dup (0)
  147. 107                    0000         
  148. 108                          ]         
  149. 109                        
  150. 110     008A                   ndp_cw    label    word
  151. 111     008A  0000                   dw    0
  152. 112     008C                   cpuid    endp
  153. 113     008C                   code    ends
  154. 114                             end
  155.  
  156.  Microsoft MACRO Assembler  Version 3.00                   Page    Symbols
  157.                    -1
  158.                                        07-08-88    
  159.  
  160.  
  161. Segments and Groups:
  162.  
  163.          N a m e              Size    Align    Combine    Class
  164.  
  165. CODE . . . . . . . . . . . . . .    008C    BYTE      PUBLIC    
  166.  
  167. Symbols:            
  168.  
  169.          N a m e              Type    Value    Attr         
  170.  
  171. A1 . . . . . . . . . . . . . . .    L NEAR     0013    CODE
  172. A2 . . . . . . . . . . . . . . .    L NEAR     001E    CODE
  173. A3 . . . . . . . . . . . . . . .    L NEAR     002B    CODE
  174. A4 . . . . . . . . . . . . . . .    L NEAR     003A    CODE
  175. A5 . . . . . . . . . . . . . . .    L NEAR     0043    CODE
  176. A6 . . . . . . . . . . . . . . .    L NEAR     007A    CODE
  177. CPUID. . . . . . . . . . . . . .    N PROC    0000    CODE    Global    Length 
  178.                    =008C
  179. NDP_CW . . . . . . . . . . . . .    L WORD     008A    CODE
  180. NDP_ENV. . . . . . . . . . . . .    L WORD     007C    CODE
  181.  
  182. 49698 Bytes free   
  183.  
  184. Warning Severe
  185. Errors    Errors 
  186. 0    0
  187.